package com.eastdigit.bpm.formType;

import java.util.Iterator;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.activiti.engine.impl.form.EnumFormType;

public class MyEnumFormType extends EnumFormType {
    
    private static final long serialVersionUID = 12L;

    public MyEnumFormType(Map<String, String> values) {
        super(values);
    }
    
    public JSONArray getValues(){
        JSONArray array = new JSONArray();
        if(values != null && !values.isEmpty()){
            Iterator<String> iter = values.keySet().iterator();
            while(iter.hasNext()){
                JSONObject value = new JSONObject();
                String id = iter.next();
                value.put("value", id);
                value.put("name", values.get(id));
                array.add(value);
            }
        }
        return array;
    }
}
